package oo5;

import oo4.Dog;
import oo4.Penguin;
import oo4.Pet;

public class DogTest6 {

	public static void main(String[] args) {
		Pet d = new Dog("中华田园犬", "二黄", 100, 99, "母");
		System.out.println(d.getName());
		d.show();
		// 向下转型
		Dog d2 = (Dog) d;
		d2.catchMouse("米老鼠");

		// Pet p2 = new Penguin("萌萌哒");
		Pet p2 = new Dog("中华田园犬", "大黄", 100, 99, "母");
		System.out.println(">>>>>>>>>>>>>>>>>>.");
		if (p2 instanceof Dog) {
			Dog d3 = (Dog) p2;
			d3.catchMouse("米老鼠");
		} else {
			System.out.println("这不是狗，不能抓老鼠");
		}
	}

}
